package code

import "net/http"

// TODO 使用golang代码生成来做
func init() {
	//
	register(ErrParamsInvalid, http.StatusBadRequest, "params is invalid")
	register(ErrNotFound, http.StatusNotFound, "not found")
	register(ErrInternal, http.StatusInternalServerError, "interal error")

	register(ErrMasterDown, http.StatusInternalServerError, "master ceph is down")
	register(ErrSlaveDown, http.StatusInternalServerError, "slave ceph is down")
	register(ErrAllDown, http.StatusInternalServerError, "all cephs are down")

	register(ErrSyncRequestMaster, http.StatusInternalServerError, "request master failed using sync")
	register(ErrSyncRequestSlave, http.StatusInternalServerError, "request slave failed using sync")
	register(ErrSyncRequestAny, http.StatusInternalServerError, "request any ceph failed using sync")
	register(ErrSyncRequestStatusInvalid, http.StatusInternalServerError, "different response status code using sync")

	register(ErrAsyncRequestMaster, http.StatusInternalServerError, "request master failed using async")
	register(ErrAsyncRequestAny, http.StatusInternalServerError, "request slave failed using async")

	register(ErrDirectRequestFail, http.StatusInternalServerError, "request failed using diector")
	register(ErrDirectRequestAny, http.StatusInternalServerError, "request failed using diector")

	register(ErrDatabase, http.StatusInternalServerError, "Database error")

	register(ErrUnsupportRequest, http.StatusBadRequest, "ceph porxy unsupport")
	register(ErrAkNotFound, http.StatusUnauthorized, "cache not found accesskey")
	register(ErrTooManyRequests, http.StatusTooManyRequests, "http request too many")

	register(ErrParseAkFromHeader, http.StatusUnauthorized, "parse ak from header failed")
	register(ErrNotRegisterCephProxy, http.StatusUnauthorized, "ak not found in cephproxy platform")
	register(ErrValidateSign, http.StatusUnauthorized, "validate signature failed for part upload")

	register(ErrDataRepeated, http.StatusBadRequest, "the same data already exists")

}
